{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}专线{% endblock %}

{% block content %}

    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
       专线管理
      </h1>
      <ol class="breadcrumb">
        <li><a href={% url 'dashboard' %}><i class="fa fa-dashboard"></i> 主页</a></li>
        <li class="active">专线管理</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <form action={% url 'circuit' %}  method="get">
            <div class="form-group">
              <div class="row">
                <div class="col-xs-4">
                  <label for="search">专线名称</label>
                  <textarea id='name' rows='1' class="form-control" name='name'></textarea>
                </div>
                <div class="col-xs-2">
                  <label for="search">状态</label>
                  <select class="form-control" name='status' id='status'>
                    <option selected value></option>
                    <option value='0'>运营</option>
                    <option value='1'>拆除</option>
                    <option value='2'>待启用</option>
                  </select>
                </div>
                <div class="col-xs-2">
                  <label for="search">类型</label>
                  <select class="form-control" name='circuit_type' id='circuit_type'>
                    <option selected value></option>
                    <option value='0'>Fiber</option>
                    <option value='1'>DWDM</option>
                    <option value='1'>LAN</option>
                    <option value='1'>SDH</option>
                  </select>
                </div>
                <div class="col-xs-2">
                  <label for="search">业务线</label>
                  <select class="form-control" name='business_unit' id='business_unit'>
                    <option selected value></option>
                    <option value='0'>领骏</option>
                    <option value='1'>驰联</option>
                  </select>
                </div>
                <div class="col-xs-2">
                  <label for="search">自用</label>
                  <select class="form-control" name='self_use_status' id='self_use_status'>
                    <option selected value></option>
                    <option value='0'>是</option>
                    <option value='1'>否</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="row">
                <div class="col-xs-2">
                  <label for="search">专线编号</label>
                  <textarea id='number' rows='1' class="form-control" name='number'></textarea>
                </div>
                <div class="col-xs-2">
                  <label for="search">用户</label>
                  <input type="text" class="form-control" name='customer'>
                </div>
                <div class="col-xs-2">
                  <label for="search">运营商</label>
                  <input type="text" class="form-control" name='isp'>
                </div>  
                <div class="col-xs-2">
                  <label for="search">维护人</label>
                  <input type="text" class="form-control" name='maintainer'>
                </div>
              </div>
            </div>
            <p style=" margin:0 auto; text-align:center;">
              <button type="submit" id="searchbutton" align="center" class="btn">查询</button>
            </p>
           </form>
    <div class="row">
    <div class="col-xs-12">
      <div>
          <label class="checkbox-inline">
          专线名称<input type="checkbox" class="toggle-vis" data-column="0" checked="checked"/>
          </label>
          <label class="checkbox-inline">
          专线编号<input type="checkbox" class="toggle-vis" data-column="1" checked="checked"/>
          </label>
          <label class="checkbox-inline">
          类型<input type="checkbox" class="toggle-vis" data-column="2" checked="checked"/>
          </label>
           <label class="checkbox-inline">
           带宽<input type="checkbox" class="toggle-vis" data-column="3" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           状态<input type="checkbox" class="toggle-vis" data-column="4" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           业务线<input type="checkbox" class="toggle-vis" data-column="5" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           是否自用<input type="checkbox" class="toggle-vis" data-column="6" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           用户<input type="checkbox" class="toggle-vis" data-column="7" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           维护人<input type="checkbox" class="toggle-vis" data-column="8" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           VLAN<input type="checkbox" class="toggle-vis" data-column="9" />
           </label>
           <label class="checkbox-inline">
           运营商<input type="checkbox" class="toggle-vis" data-column="10"/>
           </label>
           <label class="checkbox-inline">
           运营商接口人<input type="checkbox" class="toggle-vis" data-column="11"/>
           </label>
           <label class="checkbox-inline">
           运营商报障电话<input type="checkbox" class="toggle-vis" data-column="12"/>
           </label>
           <label class="checkbox-inline">
           裸纤长度<input type="checkbox" class="toggle-vis" data-column="13"/>
           </label>
           <label class="checkbox-inline">
           裸纤衰耗<input type="checkbox" class="toggle-vis" data-column="14"/>
           </label>
           <label class="checkbox-inline">
           启用日期<input type="checkbox" class="toggle-vis" data-column="15"/>
           </label>
           <label class="checkbox-inline">
           拆除日期<input type="checkbox" class="toggle-vis" data-column="16"/>
           </label>
           <label class="checkbox-inline">
           起始端机房单元<input type="checkbox" class="toggle-vis" data-column="17"/>
           </label>
           <label class="checkbox-inline">
           起始端机架<input type="checkbox" class="toggle-vis" data-column="18"/>
           </label>
           <label class="checkbox-inline">
           起始端设备<input type="checkbox" class="toggle-vis" data-column="19"/>
           </label>
           <label class="checkbox-inline">
           起始端设备端口<input type="checkbox" class="toggle-vis" data-column="20"/>
           </label>
           <label class="checkbox-inline">
           终止端机房单元<input type="checkbox" class="toggle-vis" data-column="21"/>
           </label>
           <label class="checkbox-inline">
           终止端机架<input type="checkbox" class="toggle-vis" data-column="22"/>
           </label>
           <label class="checkbox-inline">
           终止端设备<input type="checkbox" class="toggle-vis" data-column="23"/>
           </label>
           <label class="checkbox-inline">
           终止端设备端口<input type="checkbox" class="toggle-vis" data-column="24"/>
           </label>
           <label class="checkbox-inline">
           路由<input type="checkbox" class="toggle-vis" data-column="25"/>
           </label>
           <label class="checkbox-inline">
           DWDM<input type="checkbox" class="toggle-vis" data-column="26"/>
           </label>
      </div>
      <div class="box">
        <div class="box-header">
          <h4 class="box-title">查询结果</h4>
          <a href= {% url 'assetimport' '专线' %}><button type="submit" class="btn btn-default pull-right">专线导入</button></a>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
          <table id="circuits_table" class="display table table-bordered table-striped">
            <thead>
            <tr>
              <th>专线名称</th>
              <th>专线编号</th>
              <th>类型</th>
              <th>带宽(M)</th>
              <th>状态</th>
              <th>业务线</th>
              <th>是否自用</th>
              <th>用户名称</th>
              <th>维护人</th>
              <th>VLAN</th>
              <th>运营商</th>
              <th>运营商接口人</th>
              <th>运营商报障电话</th>
              <th>裸纤长度(KM)</th>
              <th>裸纤衰耗</th>
              <th>启用日期</th>
              <th>拆除日期</th>
              <th>起始端机房单元</th>
              <th>起始端机架</th>
              <th>起始端设备</th>
              <th>起始端设备端口</th>
              <th>终止端机房单元</th>
              <th>终止端机架</th>
              <th>终止端设备</th>
              <th>终止端设备端口</th>
              <th>路由</th>
              <th>DWDM</th>
            </tr>
            </thead>
            <tbody>
                {% for circuit in circuit %}
                <tr>
                  <td><a href="{% url 'circuitdetail' circuit.id %}" target=_blank >{{ circuit.name }}</td>
                  <td>{{ circuit.number }}</td>
                  <td>{{ circuit.get_circuit_type_display }}</td>
                  <td>{{ circuit.bw|default:'' }}</td>  
                  <td>{{ circuit.get_status_display }}</td>
                  <td>{{ circuit.get_business_unit_display}}</td>
                  <td>{{ circuit.get_self_use_status_display }}</td>                
                  <td>{{ circuit.customer|default:'' }}</td>
                  <td>{{ circuit.maintainer|default:'' }}</td>
                  <td>{{ circuit.vlan|default:'' }}</td>
                  <td>{{ circuit.isp|default:'' }}</td>
                  <td>{{ circuit.isp_contacts|default:'' }}</td>
                  <td>{{ circuit.isp_contacts_phonenumber|default:'' }}</td>
                  <td>{{ circuit.circuit_lenth|default:'' }}</td>
                  <td>{{ circuit.attenuation|default:'' }}</td>
                  <td>{{ circuit.date_online|date:"Y-m-d" }}</td>
                  <td>{{ circuit.date_dismantle|date:"Y-m-d" }}</td>
                  <td>{{ circuit.machineroom_a|default:'' }}</td>
                  <td>{{ circuit.cabinet_a|default:'' }}</td>
                  <td>{{ circuit.networkdevice_a.hostname|default:'' }}</td>
                  <td>{{ circuit.port_a|default:'' }}</td>
                  <td>{{ circuit.machineroom_z|default:'' }}</td>
                  <td>{{ circuit.cabinet_z|default:'' }}</td>
                  <td>{{ circuit.networkdevice_z.hostname|default:'' }}</td>
                  <td>{{ circuit.port_z|default:'' }}</td>
                  <td>{{ circuit.router|default:'' }}</td>
                  <td>{{ circuit.dwdm|default:'' }}</td>
                </tr>
                {% empty %}
                  <tr>没有数据！</tr>
                {% endfor %}

            </tbody>
          </table>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
    </div>
    <!-- /.row -->
    </section>

{% endblock %}
{% block page-script %}
<script src="{% static 'js/mygeturl.js' %}"></script>
{% endblock %}
